package com.wei.stavix.ui.module.account

import android.util.Log
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch

class AccountViewModel : ViewModel() {

    var pageShowFlag by mutableStateOf(0)
    //val shareFlow2 = MutableSharedFlow<Tflow>()
//    var onBackDown = MutableSharedFlow<Int>()
    var onBackDown = MutableStateFlow(0)
//    var onBackDown2 = MutableLiveData<Int>(0)

    fun onTopBackClick(flag: Int) {
        viewModelScope.launch {
            Log.i("compose", "onTopBackClick flag :$flag")
            onBackDown.emit(flag)
        }
    }

    fun launch2Register() {
        pageShowFlag = 1
    }

    fun launch2ForgotPwd() {
        pageShowFlag = 3
    }

//    var loginCount by mutableStateOf(0)
    var loginCount = 0
    fun clickLogin() {
        ++loginCount
        Log.i("compose", "clickLogin $loginCount")
    }

    fun clickSend() {
        Log.i("compose", "clickSend $loginCount")
    }
}